$(function(){
	App.init();
	$('.select2-search').remove();
    $('.content select').addClass('form-control');
    $('label.tree-list').click(function () {
        var icon = $(this).children(".fa");
        if (icon.hasClass("fa-folder-o")) {
            icon.removeClass("fa-folder-o").addClass("fa-folder-open-o");
        } else {
            icon.removeClass("fa-folder-open-o").addClass("fa-folder-o");
        }

        $(this).parent().children('ul.tree').toggle(300, function () {
            $(this).parent().toggleClass("open");
            $(".tree .nscroller").nanoScroller({
                preventPageScrolling: true
            });
        });

    });
    
    $('.searchoption').click(function () {
        $(this).closest('.col-sm-12').hide();
        $('.search-plan').toggle();
    });
    
    $('.content tr').hover(function () {
        $(this).addClass("table-hover");
    }, function () {
        $(this).removeClass("table-hover");
    });
})

var post_json = function(posturl,postdata,successhandle,errorhandle,sync){
    $.ajax({
        url: posturl,
        type: 'POST',
        dataType: 'json',
        cache: false,
        data: postdata,
        async:!sync,
        success: function (data) {
            successhandle(data);
        },
        error: function () {
            if (errorhandle)
                errorhandle('服务器超时，请重试!');
            else{
            	console.log('服务器返回数据格式出现异常');
            }
        }
    });
};